
#include "monster.h"
#include "player.h"

Monster::Monster(const std::string& _name, Player* _enemy, const int& _health, const int& _attack, const int& _defense, const int& _speed, const int& _experience) :
    Entity(_name, _health, _attack, _defense, _speed), enemy(_enemy), experience(_experience)
{
    //null;
}

void Monster::attack()
{
    // attacks the player
    double dmg = getAttack() - enemy->getDefense();
    if (dmg <= 0)
    {
        std::cout << getName() << " hits " << enemy->getName() << ", but deals no damage." << std::endl;
    } else
    {
        std::cout << getName() << " hits " << enemy->getName() << " for " << dmg << " damage." << std::endl;
    }
    enemy->takeDamage(dmg);
}
